package com.group56.view.userend.video_module;

import com.group56.TestApp;
import com.group56.utils.FXMLSrcMenu;
import com.group56.utils.FXMLViewHandler;
import com.group56.viewmodel.UserInfoViewModel;
import com.group56.viewmodel.VideoInfoViewModel;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

import java.awt.*;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

public class VideoDetailController implements Initializable {
    public static String videoName;
    VideoInfoViewModel videoInfoViewModel=VideoInfoViewModel.getInstance(videoName);
    UserInfoViewModel userInfoViewModel=UserInfoViewModel.getInstance(TestApp.customerId);
    @FXML
    private Label name;
    @FXML
    private Label Category;
    @FXML
    private Label price;
    @FXML
    private Label description;
    @FXML
    private ImageView imageView;
    @FXML
    private Button purchase;
    @FXML
    private Button watch;
    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        name.setText(videoInfoViewModel.getVideoDTO().getName());
        price.setText("1 £");
        description.setText(videoInfoViewModel.getVideoDTO().getDescription());
        description.setWrapText(true);
        Image image=new Image(videoInfoViewModel.getVideoDTO().getPicUrl());
        imageView.setImage(image);
        Category.setText(videoInfoViewModel.getVideoDTO().getCategories());

    }
    public void purchase() throws IOException {
//        Stage primaryStage=(Stage)description.getScene().getWindow();
        Stage stage=new Stage();
        FXMLViewHandler.putViewInStage(stage, FXMLSrcMenu.UserEnd.PURCHASE.getSrc(), "login/register");
        stage.show();
    }
    public void watch(){

    }
}
